package com.rc.saas.mini.service.hlht;

import com.rc.saas.mini.mapper.hlht.HlhtTenantOpenStationMapper;
import com.rc.saas.mini.model.hlht.HlhtTenantOpenStation;
import com.rc.saas.mini.model.hlht.HlhtTenantOpenStationExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author wangzhengwei
 * @create 2021/12/18
 */
@Service
public class HlhtTenantOpenStationServiceImpl implements HlhtTenantOpenStationService {

    @Autowired
    private HlhtTenantOpenStationMapper hlhtTenantOpenStationMapper;

    @Override
    public HlhtTenantOpenStationMapper getMapper() {
        return hlhtTenantOpenStationMapper;
    }

    @Override
    public HlhtTenantOpenStation selectByhlhtTenantOpenStationBySaas(String hlhtTenantCode, String tenantCode, Long elecStationId, String hlhtOpenType) {
        HlhtTenantOpenStationExample example = new HlhtTenantOpenStationExample();
        example.createCriteria().andHlhtOpenTypeEqualTo(hlhtOpenType).andHlhtTenantCodeEqualTo(hlhtTenantCode).andTenantCodeEqualTo(tenantCode).andOperateStatusEqualTo("1").andElecStationIdEqualTo(elecStationId);
        return hlhtTenantOpenStationMapper.selectByExample(example).stream().findFirst().orElseGet(() -> null);
    }
}
